package com.smartao.base.department;

import java.util.List;

import com.smartao.core.dao.BaseDao;

public interface DepartmentDao extends BaseDao<Department, Long>{
	
	/**
	 * 获取更节点,根节点唯一; 如果不提供维度,则查找新政维度;
	 * @return
	 */
	public Department findRoot();
	
	/**
	 * 按维度获取更节点,根节点唯一
	 * @return
	 */
	public Department findRoot(Long dimensionId);
	
	/**
	 * 查询直接下属部门
	 */
	public List<Department> findByParent(Long pid);
	
	/**
	 * 查询所有子部门
	 * */
	public List<Department> getAllChild(Department department);
	
	/**
	 * 查询部门族谱
	 * @param key1
	 * @param key2
	 * @return
	 */
	public List<Department> getPath(Department department);
	/**
	 * 查询直接下属部门数
	 * @param id
	 * @return
	 */
	public Long getDierctChildCount(Long id);
	
	public void batchUpdateLeftRightKey(int pRight);

	void batchUpdateRightKey(Integer key, Long dimensionId);

	void batchUpdateLeftKey(Integer key, Long dimensionId);
}